<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script>
    window.onload = function () {
      // var arr  = new Array(100,true,"123");
      var arr = [100,true,"123"];
      // for(var i=0;i<arr.length;i++){
      //   console.log(arr[i]);
      // }
      // arr.forEach(element => {
      //   console.log(element);
      // });
      // for (var a in arr) {
      //   console.log(arr[a]);
      // }
      // for (var a of arr) {
      //   console.log(a);
      // }
      console.log(arr);
      console.log(arr.push(300));
      console.log(arr);
      arr.unshift(400);
      console.log(arr);
      //连接为新的数组，原有的两个数组不变
      var b = arr.concat([1,2,3,4,5]);
      // console.log(arr);
      console.log(b);
      // b.pop();
      // console.log(b);
      // b.shift();
      // console.log(b);      
      // console.log(b.splice(2,4));      
      // console.log(b); 
      
      console.log( b.slice(2,4));
      

    }
  </script>
</head>
<body>
  
</body>
</html>